home *** CD-ROM | disk | FTP | other *** search
Text File | 1989-11-10 | 2.0 KB | 62 lines | [TEXT/GEOL] |
- Item forwarded by A33 to A34
-
- Item 5658090 8-Nov-89 18:10
-
- From: D2234 Cock, Calvin,PRT
-
- To: MACAPP.TEST MacApp SQA Team
-
- cc: MACAPP.TECH$ MacApp Technical
-
- Sub: TEditText Validate Prob.
-
-
- I have a complaint about the structure of TEditText in 2.0ß9 versus 2.0ß5.
- In 2.0ß5 you could OVERRIDE the validate method, do your own checking, put up
- any alerts to your user and return FALSE and the TDialogView.DoSelectEditText
- would call CantDeselect and the EditText would be reselected.
-
- With 2.0ß9, there is no way to put up your own alerts without having the
- CantDeselect method either post another alert (if your return kInvalidValue) or
- select the next EditText (If you return kValidValue).
-
- I suggest that there be declared an additional constant in the interface to
- UDialog, kErrorHandled = -1, that would signal the CantDeselect method that the
- error had already be posted and restart the edit field with the old value.
- CantDeselect then would look like this:
-
-
-
- PROCEDURE TDialogView.CantDeselect (theEditText: TEditText;
- reason: LONGINT);
-
- VAR
- aString: Str255;
-
- BEGIN
- IF (reason <> kValidValue) THEN
- BEGIN
- IF (reason <> kErrorHandled) THEN { Go ahead an post alert }
- BEGIN
- IF (reason < 1) | (reason > kNoOfDefaultReasons) THEN
- reason := kInvalidValue;
- GetIndString(aString, kInvalidValueReasons, reason);
- ParamText(aString, '', '', '');
- StdAlert(phInvalidValue);
- END;
- aString := theEditText.fDataHandle^^; { Restart with previous value }
- theEditText.RestartEdit(aString);
- END;
- END;
-
- I think that this is cleaner than having to create an abstact class
- MyDialogView with the CantDeselect OVERRIDDEN. The error handling should be
- taken care of by the TEditText object, the TDialogView object should only post
- default errors.
-
-
- Calvin Cock
- Applications Design Group
-
-
-